package com.example.abe.diandi.main;

import com.example.abe.diandi.category.model.CategoryModel;
import com.example.abe.diandi.user.model.UserModel;

import java.util.ArrayList;
import java.util.List;

import example.abe.com.framework.util.SharedPreferencesUtil;

/**
 * Created by abe on 17/3/13.
 */

public class AppConfig {

    public static final String NAME = "user_name";
    public static final String PASSWORD = "user_password";

    private static List<CategoryModel> categoryList = new ArrayList<>();

    private static UserModel userModel;

    public static List<CategoryModel> getCategoryList(){
        return new ArrayList<CategoryModel>(categoryList);
    }

    public static void setCategoryList(List<CategoryModel> list){
        categoryList.clear();
        categoryList.addAll(list);
    }

    public static UserModel getUserModel(){
        return userModel;
    }

    public static void setUserModel(UserModel model){
        userModel = model;
    }

    public static void clear(){
        categoryList.clear();
        userModel = null;
        SharedPreferencesUtil.remove(AppConfig.NAME);
        SharedPreferencesUtil.remove(AppConfig.PASSWORD);
    }
}
